package com.qingcheng.controller.goods;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.entity.PageResult;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.goods.Productlog;
import com.qingcheng.service.goods.ProductlogService;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/productlog")
public class ProductlogController {

    @Reference
    private ProductlogService productlogService;

    @GetMapping("/findAll")
    public List<Productlog> findAll(){
        return productlogService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<Productlog> findPage(int page, int size){
        return productlogService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<Productlog> findList(@RequestBody Map<String,Object> searchMap){
        return productlogService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<Productlog> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  productlogService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public Productlog findById(String id){
        return productlogService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody Productlog productlog){
        productlogService.add(productlog);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody Productlog productlog){
        productlogService.update(productlog);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String id){
        productlogService.delete(id);
        return new Result();
    }

}
